'use strict';
const BaseController = require('../base');
class RouterController extends BaseController {
  static get serviceName() {
    return 'business.dailyMenuItem';
  }

  // 批量创建菜单项
  async batchCreate() {
    const { ctx } = this;
    const menuItems = ctx.request.body;
    const result = await this.service.batchCreate(menuItems);

    this.ctx.success(result);
  }

  // 获取菜单项列表
  async getMenuItems() {
    const { ctx } = this;
    const { dailyMenuId } = ctx.query;

    if (!dailyMenuId) {
      throw new Error('缺少必要参数');
    }
    const result = await this.service.getMenuItems(dailyMenuId);
    this.ctx.success(result);
  }

  async batchUpdate() {
    const { ctx } = this;
    const menuItems = ctx.request.body;
    const result = await this.service.batchUpdate(menuItems);
    this.ctx.success(result);
  }
  async batchConfirmReceipt() {
    const { ctx } = this;
    const menuItems = ctx.request.body;
    const result = await this.service.batchConfirmReceipt(menuItems);
    this.ctx.success(result);
  }
  async batchConfirmBuy() {
    const { ctx } = this;
    const menuItems = ctx.request.body;
    const result = await this.service.batchConfirmBuy(menuItems);
    this.ctx.success(result);
  }

}
module.exports = RouterController;
